package com.tagtraum.perf.gcviewer;



class Section
{
  private final String name;
  private final WarningSeverityLevel level;
  private final boolean isOn;
  private final boolean isHeading;
  private final SectionsModel model;
  private boolean lastInGroup;

  Section(SectionsModel model, String name, WarningSeverityLevel level, boolean isHeading, boolean isOn)
  {
    this.model = model;
    this.name = name;
    this.level = level;
    this.isHeading = isHeading;
    this.isOn = isOn;
    setLastInGroup(false);
  }

  public boolean isAnalyticView() {
    return this.level != null;
  }

  public boolean isLastInGroup() {
    return (this.lastInGroup) || (this.model.isLastSection(this));
  }

  public String getName() {
    return this.name;
  }

  public WarningSeverityLevel getLevel() {
    return this.level;
  }

  public boolean isHeading() {
    return this.isHeading;
  }

  public boolean isOn() {
    return this.isOn;
  }

  public void setLastInGroup(boolean lastInGroup) {
    this.lastInGroup = lastInGroup;
  }

  public String toString()
  {
    return getName();
  }
}